package com.seata.order.service.impl;

import com.seata.order.client.StockClient;
import com.seata.order.mapper.OrderMapper;
import com.seata.order.service.OrderService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

@Service
public class OrderServiceImpl implements OrderService {

    @Resource
    private OrderMapper orderMapper;

    @Resource
    private StockClient stockClient;

    @Override
    public void create(boolean flag) {
        stockClient.decr();

        if (flag) {
            throw new RuntimeException();
        }

        orderMapper.create();


    }

}
